package com.testmanager.testmananger.quantitative.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.testmanager.testmananger.foundation.domain.AbstractAuditingEntity;
import com.testmanager.testmananger.quantitative.constants.IterationStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;


import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Accessors(chain = true)
//@org.hibernate.annotations.Table(appliesTo = "yx_iteration_status_change_record",comment = "")
@Table(name = "yx_iteration_status_change_record")
public class IterationStatusChangeRecordEntity extends AbstractAuditingEntity implements Serializable {

    private static final long serialVersionUID = 3445832923257946321L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column(name = "iteration_id")
    private long iterationID;

    @Column(nullable = false,name = "from_status")
    @Convert(converter = IterationStatusConvert.class)

    private IterationStatus fromStatus;

    @Column(nullable = false,name = "to_status")
    @Convert(converter = IterationStatusConvert.class)
    private IterationStatus toStatus;

    @Column(length = 100)
    private String comment;

    @CreatedDate
    @Column(name = "created_date",nullable = false)
    private LocalDateTime createdDate = LocalDateTime.now();


}
